package org.goyo.main.domain.entity.storage;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;

import org.goyo.main.domain.entity.BaseObject;
import org.goyo.main.domain.entity.base.Warehouse;
/**
 * 库存盘点
 * 
 * @author chenchuan
 * 2014年11月12日
 */
@Entity
public class InventoryCheck  extends BaseObject implements Serializable {

	private static final long serialVersionUID = 1L;
	//单据编号前缀
	public static final String BIZTYPE = "PD";
	/**
	 * 仓库	
	 */
	@ManyToOne
	@JoinColumn(name="warehouseId")
	private Warehouse warehouse;
	/**
	 * 盘点时间	
	 */
	@Column
	private String inventoryCheckDate;
	/**
	 * 监盘人	
	 */
	@Column
	private String supervisionPerson;
	/**
	 * 复盘人	
	 */
	@Column
	private String replayPerson;
	
	@OneToMany(fetch = FetchType.LAZY,cascade={CascadeType.ALL})
	@JoinColumn(name="parent_id")
	private List<InventoryCheckEntry> entrys = new ArrayList<InventoryCheckEntry>();

	public String getInventoryCheckDate() {
		return inventoryCheckDate;
	}
	public void setInventoryCheckDate(String inventoryCheckDate) {
		this.inventoryCheckDate = inventoryCheckDate;
	}
	public String getSupervisionPerson() {
		return supervisionPerson;
	}
	public void setSupervisionPerson(String supervisionPerson) {
		this.supervisionPerson = supervisionPerson;
	}
	public String getReplayPerson() {
		return replayPerson;
	}
	public void setReplayPerson(String replayPerson) {
		this.replayPerson = replayPerson;
	}
	public List<InventoryCheckEntry> getEntrys() {
		return entrys;
	}
	public void setEntrys(List<InventoryCheckEntry> entrys) {
		this.entrys = entrys;
	}
	public static long getSerialversionuid() {
		return serialVersionUID;
	}
	public Warehouse getWarehouse() {
		return warehouse;
	}
	public void setWarehouse(Warehouse warehouse) {
		if(warehouse != null &&("".equals(warehouse.getUuid()) || warehouse.getUuid()==null))
			this.warehouse = null;
		else
			this.warehouse = warehouse;	
	}
	
}
